package com.naiterui.ehp.bs.patient.config;

import java.util.ArrayList;
import java.util.List;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.commons.lang3.builder.ToStringBuilder;

import com.naiterui.ehp.bp.utils.beans.BeanUtil;

/**
 * @author zhoupeipei
 * @date 2019-06-19 17:16
 * @since 1.0.0
 */
@Getter
@Setter
@ToString
public class TemplateProperties {
    private String label;
    private String templateId;
    private String tId;
    private String title;
    private List<Content> content;

    /**
     * 模板配置内存共享，每次发送拷贝模板内容做格式化处理
     *
     * @return
     */
    public List<Content> cloneContent() {
        List<Content> contentList = new ArrayList<>();
        BeanUtil.copyList(content, contentList, TemplateProperties.Content.class);
        return contentList;
    }

    public static class Content {
        private String key;
        private String value;
        private String color;

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getColor() {
            return color;
        }

        public void setColor(String color) {
            this.color = color;
        }

        @Override
        public String toString() {
            return ToStringBuilder.reflectionToString(this);
        }
    }
}


